<h2>Categories</h2>




<?php
mysql_connect("localhost","root","");
mysql_select_db('noc');
$find = mysql_query("select * from `category`");
if ( mysql_numrows($find) > 0) {

    while($display = mysql_fetch_assoc($find) ) {

        //  echo "<pre>";

        //  print_r($display);

        //echo "</pre>";
        ?>

<div class="cat">  
    <div class ="head">
              <?php echo $display['name']; ?>
    </div>
    <div class="footer-list">
        <ul>
            

<?php
$category_id = $display['id'];

$news_query = mysql_query("select * from `news` where category_id = $category_id");
if ( mysql_numrows($news_query) > 0) {
    while($news = mysql_fetch_assoc($news_query) ) {
      
        ?>                                    
                    <li><a href="index.php?page=single_news&news_id=<?php echo $news['id'];?>"><?php echo $news['news_title'];?></a></li>


 <?php } } ?>

               
        </ul>

    </div>
</div>

        <?php
      
    }
}
?>
